<extend name="Public/publicHTML"/>
<block name="content">
    <link rel="stylesheet" href="__COMMON__/bootstrap/css/bootstrap.min.css" />
    <div id="ajax_return">
        <div class="table-responsive">
            <table class="table table-bordered table-hover">
                <thead>
                <td class="text-left">选择</td>
                <td class="text-left">id</td>
                <td class="text-left">商品名称</td>
                <td class="text-left">价格</td>
                <td class="text-left">库存</td>
                <td class="text-left">操作</td>
                </tr>
                </thead>
                <tbody id="goos_table">
                <volist name="goodsList" id="list">
                    <tr>
                        <td class="text-left">
                            <input type="radio" class="xz-radio" name="goods_id" value="{$list.id}"/>
                        </td>
                        <td class="text-left">{$list.id}</td>
                        <td class="text-left">{$list.title}</td>
                        <td class="text-left">{$list.price_market}</td>
                        <td class="text-left">{$list.stock}</td>
                        <td><a href="javascript:void(0)" onclick="javascript:$(this).parent().parent().remove();">删除</a></td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
        <div class="row">
            <div class="text-left col-sm-10">
                {$page}
            </div>
            <div class="text-right col-sm-2">
                <a href="javascript:void(0)" style="margin:20px 0;" onclick="select_goods();" class="btn btn-info">确定</a>
            </div>
        </div>
    </div>
    </div>
    </div>
    </div>
    </section>
    <script>
        function select_goods()
        {
            if($("input[type='radio']:checked").length == 0)
            {
                layer.alert('请选择商品', {icon: 2}); //alert('请选择商品');
                return false;
            }
            //将没选中的复选框所在的  tr  remove  然后删除复选框
            $("input[type='radio']").each(function(){
                if($(this).is(':checked') == false)
                {
                    $(this).parent().parent().remove();
                    //$("#goods_list", window.parent.document).append("<tr>"+$(this).html()+'<td><a href="javascript:;" class="icon-close" onclick="goods_del(this)"></a></td></tr>');
                }else{
                    $(this).parent().css('display','none');
                    $(this).attr("checked","checked");
                }
                //$(this).siblings().show();
            });
            $(".btn-info").remove();
           
            javascript:window.parent.call_back($('#goos_table').html());
        }
    </script>
    </div>
</block>

